<?php foreach($flows as $flow): ?>
<legend><?php echo $flow->workflow_name ?>图形表示</legend>
<?php
/// Set up database connection.
$connectionString = StringUtil::getConnectionString(Yii::app()->db->connectionString, 
	Yii::app()->db->driverName, 
	Yii::app()->db->username, 
	Yii::app()->db->password);
$db = ezcDbFactory::create($connectionString);

// Set up workflow definition storage (database).
$definition = new ezcWorkflowDatabaseDefinitionStorage($db);

// Load latest version of workflow named by id.
$workflow = $definition->loadByName($flow->workflow_name);
$visitor = new ezcWorkflowVisitorVisualization;
$workflow->accept( $visitor ); 
$dotPath = Yii::app()->runtimePath . "/{$flow->workflow_name}";
$jpgPath = Yii::app()->runtimePath . "/{$flow->workflow_name}.jpg";
file_put_contents($dotPath, $visitor);
$ret = exec("dot -Tjpg $dotPath -o $jpgPath");

echo "<img src=\"?r=workflow/image&name={$flow->workflow_name}\"/>";
?>
<?php endforeach ?>
